package com.itheima.edu.info.manager.domain;

import com.itheima.edu.info.manager.dao.UserDao;

import java.util.ArrayList;

public class UserDaoImpl implements UserDao {
    private static ArrayList<User> array = new ArrayList<>();

    @Override
    public boolean isLogin(String username, String password) {
        boolean flag = false;
        for (User u : array) {
            if (u.getUsername().equals(username) && u.getPassword().equals(password)) {
                flag = true;
                break;
            }
        }
        return flag;
    }

    @Override
    public void regist(User user) {
        array.add(user);
    }
}
